<template>
  <div class="maskCenter">
    <div
      id="box"
      :class="visible?'systemDialog':'systemDialog-hide'"
      style="height:500px;width:320px;"
    >
      <div class="dialog-header" v-movew>
        <span>选择系统模块</span>
        <el-tooltip class="item" effect="dark" content="关闭" placement="top-start">
          <span class="icon iconfont iconbiaoqianlan-guanbi close" @click="hide"></span>
        </el-tooltip>
      </div>
      <div class="dialog-body">
        <menuTree
          :type="0"
          :roleType="0"
          :dropMenuShow="0"
          @getNodeInfo="setNodeInfo"
          ref="tree"
          :param="param"
        ></menuTree>
      </div>
      <div class="dialog-footer right">
        <span class="systemButtonConfirm" @click="okclick">确认</span>
        <span class="systemButtonConfirm" @click="hide">取消</span>
      </div>
    </div>
  </div>
</template>

<script>
import movew from "@/directives/winmove";
import { deepCopy } from "@/utils/public";
import menuTree from "@/system/components/menuTree.vue";
export default {
  directives: { movew },
  name: "winMenu",
  props: {},
  data() {
    return {
      visible: true,
      tableAttr: null,
      info: {},
      param: {
        parentId: 0,
      },
    };
  },
  components: {
    menuTree,
  },
  mounted() {
    if (this.activeItem) {
      this.info = deepCopy(this.activeItem);
    } else {
      this.$set(this.info, "state", 1);
    }
    console.log(this.info);
  },
  methods: {
    hide() {
      this.visible = false;
      setTimeout(() => {
        this.$emit("close");
      }, 400);
    },
    okclick() {
      if (this.info.type == 1) {
        this.visible = false;
        setTimeout(() => {
          this.$emit("ok", this.info);
        }, 400);
      } else {
        this.message("必须选具体的模块！", 3);
      }
    },
    setNodeInfo(e) {
      this.info = e;
    },
  },
};
</script>

<style scoped>
.mask {
  height: 100%;
  width: 100%;
  position: fixed;
  top: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header {
  display: flex;
  justify-content: space-between;
  height: 40px;
  line-height: 40px;
  background: var(--win-head-back-color);
  margin: 4px;
  text-align: left;
}
.header .title {
  width: calc(100% - 25px);
  height: 40px;
  line-height: 40px;
  font-size: 16px;
  font-family: Microsoft YaHei;
  font-weight: 400;
  color: var(--system-page-topbar-text-color);
  margin-left: 12px;
}
.header .close {
  font-size: 12px;
  width: 12px;
  height: 12px;
  margin-right: 9px;
}

.dialog-body {
  flex-direction: row;
  color: var(--system-page-topbar-text-color);
}

/*表单背景宽高设置*/
.open-content {
  background: var(--win-page-back-color);
  box-shadow: 0px 10px 20px 0px var(--win-page-shadow-color),
    0px -10px 20px 0px var(--win-page-shadow-color);
  border-radius: 4px;
  overflow: hidden;
  animation: myscale 0.4s;
}

/*表单打开动画*/
@keyframes myscale {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/*表单关闭样式及动画*/
.open-content-hide {
  background: var(--win-page-back-color);
  box-shadow: 0px 10px 20px 0px var(--win-page-shadow-color),
    0px -10px 20px 0px var(--win-page-shadow-color);
  border-radius: 4px;
  overflow: hidden;
  animation: myscalehide 0.4s;
  transform: scale(0.6);
  opacity: 0;
}

@keyframes myscalehide {
  0% {
    opacity: 1;
    transform: scale(1);
  }

  100% {
    opacity: 0;
    transform: scale(0.6);
  }
}

@keyframes fadeInLeft {
  0% {
    opacity: 0;
    transform: translateX(-120px);
  }

  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

.body-row {
  display: flex;
  line-height: 32px;
  height: 32px;
  margin-top: 10px;
  width: 100%;
}
.row-content {
  margin-left: 15px;
  width: 227px;
}
/*element 输入框样式*/
>>> .el-input__inner {
  line-height: 32px;
  height: 32px;
  width: 227px;
  border: 1px solid var(--input-border-color);
  border-radius: 4px;
  color: var(--input-text-color);
  font-size: 14px;
  font-family: Microsoft YaHei;
  font-weight: 400;
}
/*element 下拉框*/
>>> .el-input__inner:focus {
  border: 1px solid var(--input-focus-border-color);
}
/*下拉框箭头*/
>>> .el-select__caret {
  line-height: 32px;
}
>>> .el-select {
  width: 227px;
}

.footer {
  padding-right: 20px;
  height: 60px;
  line-height: 60px;
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  margin-bottom: 20px;
}
>>> .el-tree {
  height: 373px;
  overflow: auto;
}

>>> .el-tree > .el-tree-node {
  min-width: 100%;
  display: inline-block;
}
</style>